package com.sekla.comfunc;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.TestJoin")
public class TestJoin {
    // join的用法，等待线程结束
    // join带参数会限制时间
    // join就是把程序阻塞在此 等待线程完成
    static int i = 0;

    public static void main(String[] args) throws InterruptedException {
        test();
    }
    private static void test() throws InterruptedException {
        Thread t = new Thread(() -> {
            i = 10;
        });
        t.start();
        t.join();
        System.out.println(i);
    }
}
